/**
 *
 */
package com.angel.resourceBundle.daos.propertyValue.impl;

import java.io.Serializable;
import java.util.Collection;

import org.apache.commons.collections15.CollectionUtils;
import org.hibernate.criterion.Restrictions;

import com.angel.resourceBundle.daos.propertyValue.SimplePropertyValueDAO;
import com.angel.resourceBundle.propertyValue.impl.SimplePropertyValue;
import com.angel.resourceBundle.transformers.PropertyValueToSimplePropertyValueTransformer;

/**
 * @author William
 *
 */
public class SimplePropertyValueHibernateDAO extends PropertyValueHibernateDAO<SimplePropertyValue, Serializable> implements SimplePropertyValueDAO{

	public Collection<SimplePropertyValue> findAllBetweenCounter(Long minimumCounter, Long maximumCounter) {
		Collection<SimplePropertyValue> propertiesValues = super.findAllByCriteria(Restrictions.gt("counter", minimumCounter), Restrictions.lt("counter", maximumCounter));
		return CollectionUtils.transformedCollection(propertiesValues, new PropertyValueToSimplePropertyValueTransformer());
	}

	public Collection<SimplePropertyValue> findAllByCounter(Long counter) {
		Collection<SimplePropertyValue> propertiesValues = super.findAll("counter", counter);
		return CollectionUtils.transformedCollection(propertiesValues, new PropertyValueToSimplePropertyValueTransformer());
	}

	public SimplePropertyValue findUniqueByLabel(String label) {
		return super.findUnique("label", label);
	}
}
